function localization_setup_msg_cycle( alg_param, start_node )
    global g1400_cur_node;
    global g1400_LMap;
    global g1400_finished;
    global g1400_LMap_next;
    global hEdit7;
    
    g1400_cur_node = start_node;
    
    if start_node == 1
        g1400_LMap = g1400_LMap_next;
        
        % sprawdzenie czy nie nalezy zakonczyc:
        if g1400_LMap(:,1) == 0
           g1400_finished = 1;
        end
            
        g1400_LMap_next(:,1) = 0; % domyslnie nic nie obrabiamy w kolejnej iteracji
        set(hEdit7,'String',localization_avg_error());
    end
end

%% Funkcja licząca średni błąd
function [error] = localization_avg_error()
    global g1400_LMap;
    global S_Map;
    global nodes_count;
    
    LMap = g1400_LMap;
    
    sum = 0;
    for i=1:nodes_count;
        sum = sum + sqrt((S_Map(i,1) - LMap(i,3))^2 + (S_Map(i,2) - LMap(i,4))^2);
    end;
    
    error = fix(sum/nodes_count * 100)/100;
end
